home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
The World of Computer Software.iso
/
pbaseiv.zip
/
P4UTL004.TIP
< prev
next >
Wrap
Text File
|
1991-12-16
|
3KB
|
81 lines
While running Windows 3.0 in 386 enhanced mode, there's no
way to modify DOS's master copy of the environment. For
example, it's not possible to change the system PATH after
starting Windows. Revising the PATH from a COMMAND window or
a batch file affects only that copy of the environment; the
PATH settings of other windows remain unchanged.
To get around this deficiency, I wrote EDITENV.PAS [see
listing] for Turbo Pascal and TurboPower Software's Object
Professional. To edit an environment variable, type EDITENV
<name>, where <name> is the variable in question--for
example, path or lib. In order to display all variables,
their settings, and the amount of unused environment space,
type editenv /d.
Brian Foley
Colorado Springs, Colorado
Editor's note: EDITENV's usefulness isn't limited to
Windows. The program is handy for editing environment
settings from DOS too. I also use it to determine how full
my environment is after booting.
A copy of EDITENV.EXE is included, ready to run, in the
P4UTIL directory on your PowerBase *.* Volume IV diskette.
If you'd like to experiment with the source code, use the
Alt-F key to extract the listing to a file. To compile, use
Turbo Pascal 5.5 or 6.0 and a compatible version of Object
Professional.
EDITENV.PAS for Turbo Pascal and Object Professional edits
the master environment in Windows 3.0.
---- BEGIN LISTING ----
program EditEnv;
uses
OpString, OpDos, OpCrt, OpCmd, OpSEdit;
var
SLE : SimpleLineEditor;
E, S : string;
Env : EnvRec;
begin
E := StUpcase(ParamStr(1));
if E = '' then begin
WriteLn('Usage: EDITENV variable name');
WriteLn(' To edit variable name');
WriteLn(' Or: EDITENV /D');
WriteLn(' To display environment');
Halt;
end;
MasterEnv(Env);
if (E = '/D') or (E = '-D') then begin
DumpEnv(Env);
Halt
end;
S := GetEnvStr(Env, E);
if S = '' then begin
WriteLn('"', E, '" not found in environment');
Halt(1)
end;
SLE.Init(DefaultColorSet);
WriteLn('Current value: ', S);
SLE.ReadString('New value: ', WhereY, 1,
127, ScreenWidth-16, S);
if (SLE.GetLastCommand <> ccQuit) then begin
WriteLn;
if SetEnvStr(Env, E, S) then
WriteLn('Environment string changed')
else
WriteLn('Unable to change environment');
end
end.
---- END LISTING ----
Title: Mastering Your Environment
Category: DOS
Issue date: Mar 1991
Editor: Tom Swan
Supplementary files: P4UTIL\EDITENV.EXE